export default {
	name: "query-roles",
	data() {
		return {
			firstParams: [
				{label: "角色编码", kind: "input", prop: "code", isEdit: false, disabled: false}
			],
			secondParams: [],
			columns: [
				{label: "编号", prop: "id", kind: "input", width: 120, sortable: true, isSum: false},
				{label: "角色编码", prop: "code", kind: "input", width: 200, sortable: false, isSum: false},
				{label: "权限等级", prop: "permission", kind: "input", width: 200, sortable: false, isSum: false},
				{label: "角色名称", prop: "name", kind: "input", width: 280, sortable: false, isSum: false},
				{label: "角色描述", prop: "description", kind: "input", sortable: false, isSum: false}
			],
			stripe: true,
			isMultiple: false,
			isSum: false,
			data: []
		};
	},
	created() {
		this.addData();
	},
	methods: {
		addData() {
			this.data.push({
				id: 1,
				code: "guest",
				permission: 1,
				name: "匿名访客",
				description: "匿名访客，拥有部分权限"
			}, {
				id: 2,
				code: "user",
				permission: 2,
				name: "普通用户",
				description: "普通用户，拥有少部分权限"
			}, {
				id: 3,
				code: "vip1",
				permission: 3,
				name: "一级会员",
				description: "一级会员，拥有部分权限"
			}, {
				id: 4,
				code: "vip2",
				permission: 4,
				name: "二级会员",
				description: "二级会员，拥有大部分权限"
			}, {
				id: 5,
				code: "vip3",
				permission: 5,
				name: "三级会员",
				description: "三级会员，拥有大部分权限"
			}, {
				id: 6,
				code: "admin",
				permission: 6,
				name: "管理员",
				description: "管理员，拥有绝大部分管理权限"
			}, {
				id: 7,
				code: "superadmin",
				permission: 7,
				name: "超级管理员",
				description: "超级管理员，拥有所有权限"
			});
		},
		searchData() {
			return this.$refs.searchPage.filterData(this.data);
		},
		navigateTo(row) {
			this.$router.push({
				name: "add-role",
				params: {
					data: row,
					action: "update"
				}
			});
		}
	}
};
